#!/usr/bin/python
# -*- coding: UTF-8 -*-

from kpautos.engine.case import Case
from kptest.config.enum import DeviceType, HostType, DeviceUtility


class BMC_SSH_01(Case):
    """
        Name:
            BMC_SSH_01
        Label:
            FRU信息检查
        PreCondition:
            1、BMC正常运行
        TestStep:
            1、带外执行ipmcget -d fruinfo查询FRU信息
        ExpectedResult:
            A) Fru信息显示正确
        Parameters:

        Remark:

    """

    # 测试执行前配置等准备操作
    def pre_test_case(self):
        self.device_dut = self.resource.get_device(device_type=DeviceType.Server, utility=DeviceUtility.DUT)
        self.os_host = self.device_dut.get_host(host_type=HostType.HostOS)
        self.cli_api = self.device_dut.get_api(ns_name="BmcCli")

    # 测试步骤
    def procedure(self):
        self.log_step("1、带外执行ipmcget -d fruinfo命令，获取FRU信息")
        fru_info = self.cli_api.cli_query_fru()
        if fru_info == None:
            raise Exception("带外获取FRU信息失败")

    # 测试结束后恢复环境
    def post_test_case(self):
        pass